import {Steps, Icon} from "antd-mobile";
import React from "react";
import {ORDER_STATUSES} from "@/assets/js/dict.js"

const Step = Steps.Step;

let stepMap = {};



const ic = <Icon type="loading" />





//编辑中
stepMap[ORDER_STATUSES.EDITING] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.EDITING} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.AUDITING} status="wait"/>
        <Step title={ORDER_STATUSES.PUBLISH} status="wait"/>
    </Steps>
);

//审核中
stepMap[ORDER_STATUSES.AUDITING] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.AUDITING} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.PUBLISH} status="wait"/>
        <Step title={ORDER_STATUSES.APPLIED} status="wait"/>
    </Steps>
);

//已发布
stepMap[ORDER_STATUSES.PUBLISH] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.PUBLISH} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.APPLIED} status="wait"/>
        <Step title={ORDER_STATUSES.SELECTED} status="wait"/>
    </Steps>
);

//已报名
stepMap[ORDER_STATUSES.APPLIED] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.APPLIED} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.SELECTED} status="wait"/>
        <Step title={ORDER_STATUSES.PAYED} status="wait"/>
    </Steps>
);

//名额已满
stepMap[ORDER_STATUSES.FULL] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.FULL} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.SELECTED} status="wait"/>
        <Step title={ORDER_STATUSES.PAYED} status="wait"/>
    </Steps>
);

//已选择家教
stepMap[ORDER_STATUSES.SELECTED] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.SELECTED} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.PAYED} status="wait"/>
        <Step title={ORDER_STATUSES.TRIAL} status="wait"/>
    </Steps>
);

//家教已接单
stepMap[ORDER_STATUSES.PAYED] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.PAYED} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.TRIAL} status="wait"/>
        <Step title={ORDER_STATUSES.TEACHING} status="wait"/>
    </Steps>
);

//试讲中
stepMap[ORDER_STATUSES.TRIAL] = (
    <Steps direction="horizontal" current={0}>
        <Step title={ORDER_STATUSES.TRIAL} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.TEACHING} status="wait"/>
        <Step title={ORDER_STATUSES.FINISHED} status="wait"/>
    </Steps>
);

//教学中
stepMap[ORDER_STATUSES.TEACHING] = (
    <Steps direction="horizontal" current={1}>
        <Step title={ORDER_STATUSES.TRIAL}/>
        <Step title={ORDER_STATUSES.TEACHING} status="process" icon={ic}/>
        <Step title={ORDER_STATUSES.FINISHED} status="wait"/>
    </Steps>
);


//展示当前状态，进入if地狱
const buildSteps = (_status) => {
    return stepMap[_status];
};

export default buildSteps